package com.remy.util;

import java.util.UUID;

import android.app.Activity;
import android.content.Context;
import android.content.SharedPreferences;

import android.os.Build;
import android.telephony.TelephonyManager;
import android.util.Log;

public class GetDeviceInfo extends Activity{
	
	private SharedPreferences settings;
	
	public static final String SETTING_INFOS = "Setting_Infos";
	public static final String DEVICDID = "DEVICDID";
	public static final String DEVICETYPE = "DEVICETYPE";

	private String deviceModel;
	private String deviceUniqueId;
	private static UUID deviceUuid;
	

	private String getDeviceModel(){
		
		deviceModel = Build.MODEL;
		
		settings = getSharedPreferences(SETTING_INFOS,
				Activity.MODE_WORLD_READABLE);

		settings.edit().putString(DEVICETYPE, deviceModel).putString(DEVICDID, deviceUniqueId).commit();
		
		
		return deviceModel;
	}
	
	private String getMyUUID(){  
		  final TelephonyManager tm = (TelephonyManager) getBaseContext().getSystemService(Context.TELEPHONY_SERVICE);      
		  final String tmDevice, tmSerial, tmPhone, androidId;      
		  tmDevice = "" + tm.getDeviceId();     
		  tmSerial = "" + tm.getSimSerialNumber();      
		  androidId = "" + android.provider.Settings.Secure.getString(getContentResolver(),android.provider.Settings.Secure.ANDROID_ID);      
		  UUID deviceUuid = new UUID(androidId.hashCode(), ((long)tmDevice.hashCode() << 32) | tmSerial.hashCode());      
		  String uniqueId = deviceUuid.toString();  
		  Log.d("debug","uuid="+uniqueId);  
		  return uniqueId;  
	}  

}
